import Vue from 'vue'
import Router from 'vue-router'


Vue.use(Router)

export default new Router({
  scrollBehavior (to, from, savedPosition) {
    return { x: 0, y: 0 }
    // 当路由跳转的时候，默认是滚动到（0，0）位置
  },
  mode:'history',
  routes: [
    {
      path:'/',
      redirect:'/root'
    },
    {
      path: '/root',
      name: 'root',
      component:()=>import(/*webpackChunkName:"root"*/'@/page/root.vue'),
      children:[
        {
          name:'topic',
          path:'topic',
          component:()=>import('@/page/topic.vue')
        },
        {
          name:'user',
          path:'user:user_id',
          component:()=>import('@/page/user.vue')
        }
      ]
    },
    // {
    //   path: '/root',
    //   name: 'root',
    //   components: {
    //     Left:() => import('@/page/rootLeft.vue'),
    //     Middle: () =>import('@/page/rootMiddle.vue'),
    //     Right: ()=>import('@/page/rootRight.vue')
    //   }
    // }
  ]
})
